﻿Imports System.Data
Imports System.Data.SqlClient
Imports CondorTravel.BE
Imports CondorTravelUTIL.DL



Public Class TarifaDALC


    Public Function ListarTarifa() As List(Of TarifaBE)

        Dim sqlTarifaListar As String
        Dim listTarifaBE As List(Of TarifaBE) = Nothing
        Dim objTarifaBE As TarifaBE = Nothing
        Dim ds As DataSet
        Dim dt As DataTable

        Try

            sqlTarifaListar = "SP_TarifaList"

            Dim oDatos As New AccesoDatos()
            Dim bExito As Boolean
            Dim sMensaje As String = String.Empty
            Dim i As Integer = 0

            ds = oDatos.DevuelveDataSet(sqlTarifaListar, bExito, sMensaje, Nothing)
            dt = ds.Tables(0)


            listTarifaBE = New List(Of TarifaBE)()

            If dt.Rows.Count > 0 Then

                While i < dt.Rows.Count
                    objTarifaBE = New TarifaBE()
                    objTarifaBE.Codigo = CType(dt.Rows(i).ItemArray(0).ToString, Integer)
                    objTarifaBE.Descripcion = dt.Rows(i).ItemArray(1).ToString
                    i = i + 1

                    listTarifaBE.Add(objTarifaBE)
                End While
            End If

        Catch ex As Exception
            MsgBox(ex.Message, vbCritical, "Error del sistema")
            Return Nothing
            Exit Function
        End Try

        Return listTarifaBE

    End Function


End Class
